package com.ruoyi.ylyx.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ylyx.domain.YlyxRecruitpost;
import com.ruoyi.ylyx.domain.YlyxRecuittype;
import com.ruoyi.ylyx.service.IYlyxRecruitpostService;
import com.ruoyi.ylyx.service.IYlyxRecuittypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 轮播Controller
 *
 */
@Controller
@RequestMapping("/phone/ylyx/recruit")
public class YlyxRecruitPhoneController extends BaseController
{

    @Autowired
    private IYlyxRecruitpostService ylyxRecruitpostService;

    @Autowired
    private IYlyxRecuittypeService ylyxRecuittypeService;

    /**
     * 首页招聘信息
     * @return
     */
    @RequestMapping("/getRecruitHome")
    @ResponseBody
    public AjaxResult getRecruitHome(){
        List<YlyxRecuittype> typeList = ylyxRecuittypeService.selectYlyxRecuittypeList(new YlyxRecuittype());
        for(YlyxRecuittype a:typeList){
            String id = a.getId();
            YlyxRecruitpost recruitpost = new YlyxRecruitpost();
            recruitpost.setRecruitType(id);
            List<YlyxRecruitpost> list = ylyxRecruitpostService.selectYlyxRecruitpostList(recruitpost);
            a.setPostList(list);
        }
        return success("获取成功", typeList);

    }
}
